<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>js脚本操作html的样式</title>
		<script>
			function changeMe(){
				var bgc = document.getElementById("myBody").style.backgroundColor;
				//alert(bgc.toString());
				if(bgc !="rgb(188, 214, 141)"){
					document.getElementById("myBody").style.backgroundColor= "#BCD68D";
				}else{
					document.getElementById("myBody").style.backgroundColor= "#1CA261";
				}
				
			}
			
		</script>
	</head>
	<body id="myBody">
		<div>
			<input type="button" value="改变背景颜色" onmouseover="changeMe()" />
		</div>
	</body>
</html>
